﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ObTookit.Auto
{
    public class QryCoder : BaseCoder
    {
        public string CreateCode()
        {
            FieldObject pkFO = GetIdObject();
            string text = ReadTemplate(Template);
            text = text.Replace("[#AUTHOR#]", Author);
            text = text.Replace("[#CREATED#]", CreateDate);
            text = text.Replace("[#QueryNS#]", AutoObj.QryNS);
            text = text.Replace("[#TbDescir#]", AutoObj.TbDescri);
            text = text.Replace("[#ClsName#]", AutoObj.ClsName);
            text = text.Replace("[#IdAlias#]", pkFO.Alias);
            text = text.Replace("[#IdName#]", pkFO.Name);
            text = text.Replace("[#IdType#]", pkFO.Type);
            text = text.Replace("[#IdListType#]", GetListType(pkFO.Type));
            return text;
        }
    }
}
